package org.groovyflow.validation

class ListValidator extends Validator{

   def ListValidator(toValidate, args){
       super(toValidate)
       beginPath = args.path
       errors = args.errors
   }
   def validate(){
      toValidate.eachWithIndex{elem, index -> 
          def innerValidator = new ObjectValidator(elem)  //But what if the object is a list??
          innerValidator.beginPath = beginPath + index
          innerValidator.errors = errors
          innerValidator.validations = validations
          innerValidator.validate()
      }
   }
}